  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      function readFile(filePath) {
        // 创建一个新的xhr对象
        let xhr = null;
        if (window.XMLHttpRequest) {
          xhr = new XMLHttpRequest();
        } else {
          // eslint-disable-next-line
          xhr = new ActiveXObject("Microsoft.XMLHTTP");
        }
        const okStatus = document.location.protocol === "file" ? 0 : 200;
        xhr.open("GET", filePath, false);
        xhr.overrideMimeType("text/html;charset=utf-8");
        xhr.send(null);
        return xhr.status === okStatus ? xhr.responseText : null;
      }
      let result = readFile(
        "//a.amap.com/Loca/static/mock/buslines_bj_zip.txt"
      );
      console.log(result);
    </script>
  </body>
</html>
